﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace WisDom.DBContext.Migrations
{
    public partial class CreateTableScheme : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "UP_Audit",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    TableName = table.Column<string>(type: "varchar(50)", nullable: true),
                    OperTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    OperationString = table.Column<string>(type: "varchar(50)", nullable: true),
                    KeyValues = table.Column<string>(type: "varchar(50)", nullable: true),
                    OldValues = table.Column<string>(type: "text", nullable: true),
                    NewValues = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UP_Audit", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UP_BackupClientFile",
                columns: table => new
                {
                    CreateDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    CreateUserId = table.Column<string>(maxLength: 50, nullable: true),
                    CreateUserName = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    ModifyUserId = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyUserName = table.Column<string>(maxLength: 50, nullable: true),
                    FileId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    FileName = table.Column<string>(type: "varchar(50)", nullable: true),
                    ClientIp = table.Column<string>(type: "varchar(50)", nullable: true),
                    FilePath = table.Column<string>(type: "text", nullable: true),
                    BackupTypeString = table.Column<string>(type: "varchar(50)", nullable: true),
                    Remark = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UP_BackupClientFile", x => x.FileId);
                });

            migrationBuilder.CreateTable(
                name: "UP_PackageInfo",
                columns: table => new
                {
                    CreateDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    CreateUserId = table.Column<string>(maxLength: 50, nullable: true),
                    CreateUserName = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    ModifyUserId = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyUserName = table.Column<string>(maxLength: 50, nullable: true),
                    PackageId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    PackageName = table.Column<string>(type: "varchar(50)", nullable: true),
                    CheckVersionFile = table.Column<string>(type: "varchar(50)", nullable: true),
                    UpdatePath = table.Column<string>(type: "varchar(500)", nullable: true),
                    PackageTypeString = table.Column<string>(type: "varchar(50)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UP_PackageInfo", x => x.PackageId);
                });

            migrationBuilder.CreateTable(
                name: "UP_PackageSetupInfo",
                columns: table => new
                {
                    CreateDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    CreateUserId = table.Column<string>(maxLength: 50, nullable: true),
                    CreateUserName = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyDateTime = table.Column<DateTime>(type: "DateTime", nullable: true),
                    ModifyUserId = table.Column<string>(maxLength: 50, nullable: true),
                    ModifyUserName = table.Column<string>(maxLength: 50, nullable: true),
                    SetupId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    PackageId = table.Column<int>(type: "int", nullable: false),
                    Version = table.Column<string>(type: "varchar(50)", nullable: true),
                    SavePath = table.Column<string>(type: "text", nullable: true),
                    IsGetLast = table.Column<bool>(type: "bit", nullable: false),
                    IsZip = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UP_PackageSetupInfo", x => x.SetupId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "UP_Audit");

            migrationBuilder.DropTable(
                name: "UP_BackupClientFile");

            migrationBuilder.DropTable(
                name: "UP_PackageInfo");

            migrationBuilder.DropTable(
                name: "UP_PackageSetupInfo");
        }
    }
}
